cmake_minimum_required(VERSION 3.10.2)
project(distributeddb)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -fno-rtti -fvisibility=default -D_GNU_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -fPIC -fpic -ffunction-sections -D_GLIBC_MOCK")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-as-needed -ldl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=0")
set(MOCK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../mock)
add_definitions(-DUSE_HARMONY_SQLITE -DUSING_HILOG_LOGGER -DOMIT_FLATBUFFER -DEVLOOP_TIMER_ONLY) #-DOMIT_JSON
add_definitions(-DUSING_DB_JSON_EXTRACT_AUTOMATICALLY -DSQLITE_ENABLE_JSON1 -DRELATIONAL_STORE -DOMIT_ZLIB)
add_definitions(-DWINDOWS_PLATFORM -DSQLITE_HAS_CODEC -DJSONCPP_USE_BUILDER -DEKEYREVOKED=128 -DSQLITE_ENABLE_DROPTABLE_CALLBACK)
add_definitions(-Dfseeko64=fseeko)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/common/src distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/common/src/evloop/src distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/common/src/relational distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/communicator/src distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/interfaces/src distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/interfaces/src/relational distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src/multiver distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src/operation distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src/sqlite distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src/sqlite/relational distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src/upgrader distributeddbSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/syncer/src distributeddbSrc)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/interfaces/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/interfaces/include/relational)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/interfaces/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/interfaces/src/relational)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/common/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/common/include/relational)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src/multiver)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src/sqlite)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src/sqlite/relational)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src/operation)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/storage/src/upgrader)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/syncer/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/syncer/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/distributeddb/communicator/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../utils_native/base/include)
include_directories(/usr/include/jsoncpp)
include_directories(${MOCK_DIR})
include_directories(${MOCK_DIR}/sqlite/include)
include_directories(${MOCK_DIR}/innerkits/hilog_native/libhilog/include)

set(links secure mock jsoncpp crypto)
add_library(distributeddb SHARED ${distributeddbSrc})
target_link_libraries(distributeddb ${links})
